﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.SceneManagement;

public class GameMode : MonoBehaviour {
	public static GameMode instance;
	public bool gameOver = false;
	public float scollSpeed = -1.5f;

	public Text scoreTxt;
	public GameObject gameOverTxt; // 不需要做操作的

	int score = 0;


	void Awake() {
		instance = this;
	}
	// Use this for initialization
	void Start () {
		
	}
	
	// Update is called once per frame
	void Update () {
		if (gameOver && Input.GetMouseButtonDown (0)) {
			// load scene again
			SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex);
		}
	}

	public void GameOver() {
		gameOver = true;

		gameOverTxt.SetActive (true);
	}

	public void ScoreAdd() {
		if (gameOver)
			return;
		score++;
		scoreTxt.text = "SCORE: " + score.ToString ();
	}

}
